<template>
  <div class="card" :style="{ height: props.cardHeight, background: props.cardBackground }">
    <div class="pic"><slot name="icon"></slot></div>

    <div class="card__content">
      <p class="card__title">{{ props.cardTitle }}</p>
      <p class="card__description">
        {{ props.cardDescription }}
      </p>
    </div>
  </div>
</template>

<script setup name="uiCard-rotation" lang="ts">
interface IUICardConfig {
  cardColor: string
  cardTitle: string
  cardDescription: string
  cardHeight: string
  cardBackground: string
}

const props = withDefaults(defineProps<IUICardConfig>(), {
  cardColor: "",
  cardTitle: "",
  cardDescription: "",
  cardHeight: "",
  cardBackground: ""
})
</script>

<style lang="less" scoped>
.card {
  flex: 1;
  position: relative;
  // width: 300px;
  // height: 200px;
  // background: linear-gradient(-45deg, #f89b29 0%, #ff0f7b 100% );
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  margin: 0 10px;
  cursor: pointer;
}

.card .pic {
  // width: 48px;
  fill: #333;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card:hover {
  // transform: rotate(-5deg) scale(1.1);
  transform: rotate(-3deg) scale(1.1);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.card:hover .pic {
  scale: 0;
  transform: rotate(-45deg);
}

.card__content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-45deg);
  width: 100%;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  background-color: #fff;
  opacity: 0;
  transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.card:hover .card__content {
  transform: translate(-50%, -50%) rotate(0deg);
  opacity: 1;
}

.card__title {
  margin: 0;
  font-size: 24px;
  color: #333;
  font-weight: 700;
}

.card__description {
  margin: 10px 0 0;
  font-size: 14px;
  color: #777;
  line-height: 1.4;
}
</style>
